How to // Comment
Enable GZIP in Nginx // Activer GZIP dans Nginx

Ubuntu

[Ubuntu] Enable GZIP in Nginx



1. Edit the mime.types file
Open the file
  • sudo nano /etc/nginx/mime.types
Check that the following lines exist, otherwise add them:
  • application/vnd.ms-fontobject eot;
  • application/x-font-ttf ttf;
  • font/opentype ott;
  • font/x-woff woff;
2. Edit the nginx.conf file
Open the file
  • sudo nano /etc/nginx/nginx.conf
Check that the following lines are identical, otherwise modify them:
  • gzip on;
  • gzip_disable "msie6";
  • gzip_vary on;
  • gzip_proxied any;
  • gzip_comp_level 6;
  • gzip_buffers 16 8k;
  • gzip_http_version 1.1;
  • gzip_min_length 256;
  • gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/rss+xml text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/jpeg image/png image/svg+xml image/x-icon;


How to

[How to] Activer GZIP dans Nginx



1. Modifier le fichier mime.types
Ouvrez le fichier
  • sudo nano /etc/nginx/mime.types
Vérifier que les lignes suivantes existent, sinon rajoutez les :
  • application/vnd.ms-fontobject eot;
  • application/x-font-ttf ttf;
  • font/opentype ott;
  • font/x-woff woff;
2. Modifier le fichier nginx.conf
Ouvrez le fichier
  • sudo nano /etc/nginx/nginx.conf
Vérifier que les lignes suivantes sont identiques, sinon modifiez les :
  • gzip on;
  • gzip_disable "msie6";
  • gzip_vary on;
  • gzip_proxied any;
  • gzip_comp_level 6;
  • gzip_buffers 16 8k;
  • gzip_http_version 1.1;
  • gzip_min_length 256;
  • gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/rss+xml text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/jpeg image/png image/svg+xml image/x-icon;